package br.mg.bhe.ftpobre;

import org.apache.commons.net.ftp.FTPClient;

/**
 *
 * @author Aureliano
 */
public class ConnectionData {

    private String user;
    private String password;
    private String host;
    private Integer port;
    private boolean workingOnline;
    
    private FTPClient ftpCliente;

    public ConnectionData() {
        super();
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public boolean isConnected() {
    	return ((this.ftpCliente != null) && (ftpCliente.isConnected()));
    }
    
    public void setFtpClient(FTPClient ftp) {
    	this.ftpCliente = ftp;
    }
    
    public FTPClient getFtpClient() {
    	return this.ftpCliente;
    }
    
    public boolean isWorkingOnline() {
		return workingOnline;
	}

	public void setWorkingOnline(boolean workingOnline) {
		this.workingOnline = workingOnline;
	}

	@Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ConnectionData other = (ConnectionData) obj;
        if ((this.user == null) ? (other.user != null) : !this.user.equals(other.user)) {
            return false;
        }
        if ((this.password == null) ? (other.password != null) : !this.password.equals(other.password)) {
            return false;
        }
        if ((this.host == null) ? (other.host != null) : !this.host.equals(other.host)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 79 * hash + (this.user != null ? this.user.hashCode() : 0);
        hash = 79 * hash + (this.password != null ? this.password.hashCode() : 0);
        hash = 79 * hash + (this.host != null ? this.host.hashCode() : 0);
        return hash;
    }
}